﻿using System.ComponentModel;
using Newtonsoft.Json;

namespace Ecobee.Net
{
	/// <summary>
	/// The SelectionType defines the type of selection to perform. The selectionMatch specifies 
	/// the matching criteria for the type specified.
	/// </summary>
	[JsonConverter(typeof(CamelCaseStringEnumConverter))]
	public enum SelectionType
	{
		/// <summary>
		/// 
		/// </summary>
		None,
		/// <summary>
		/// When this is set the thermostats registered to the current user will be returned. This is only 
		/// usable with Smart thermostats registered to a user. It does not work on EMS thermostats and 
		/// may not be used by a Utility who is not the owner of thermostats. Match is not used.
		/// </summary>
		Registered,
		/// <summary>
		/// Select only those thermostats listed in the match criteria. No spaces in the CSV string. There 
		/// is a limit of 25 identifiers per request.
		/// </summary>
		Thermostats,
		/// <summary>
		/// 
		/// </summary>
		User,
		/// <summary>
		/// Selects all thermostats for a given management set defined by the Management/Utility account. This 
		/// is only available to Management/Utility accounts. "/" is the root, represented by the "My Sets" set.
		/// </summary>
		ManagementSet
	}

	public class Selection : SelectionItems
	{
		private SelectionType _selectionType = SelectionType.None;
		private string _selectionMatch = string.Empty;

		/// <summary>
		/// Required. The type of match data supplied: Values: None, Registered, Thermostats, User, ManagementSet. 
		/// </summary>
		[JsonProperty(PropertyName = "selectionType", Required = Required.Always)]
		[DefaultValue(false)]
		public SelectionType SelectionType
		{
			get
			{
				return _selectionType;
			}
			set
			{
				_selectionType= value;
			}
		}

		/// <summary>
		/// Required. The match data based on selectionType (e.g. a list of thermostat identifiers in the case 
		/// of a selectionType of thermostats) 
		/// </summary>
		[JsonProperty(PropertyName = "selectionMatch", Required = Required.AllowNull)]
		[DefaultValue(false)]
		public string SelectionMatch
		{
			get
			{
				return _selectionMatch;
			}
			set
			{
				_selectionMatch= value;
			}
		}
	}
}
